<?php session_start();
require_once "../core.php";
if(isset($_SESSION["user"])&&!empty($manager=$core->GetManageById($_SESSION["user"]))){
    if(!empty($manager)){
        switch ($manager["role"]){
            case "超级管理员":
            case "管理员":
                header("Location:index.php");
                break;
            case "普通":
                header("Location:Order_Menu.php");
                break;
        }
    }
}
$state=rand(100000,999999);
$ticket=GetTicket($state);
?>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>login</title>
    <script src="../static/js/jquery.min.js"></script>
</head>
<body>
<div style="text-align: center;">扫码登录乐巢会</div>
<div id="twm" style="text-align: center;">
    <?php GetCodeImage($ticket); ?>
</div>
<div id="msg"  style="text-align: center;font-size: 30px;font-weight: 900;color: green;display: none">登录成功</div>
<script>
    var Thread
        Thread=setInterval(function(){
        $.ajax({
            url:"twm.php",
            data:{user_login:<?php echo $state; ?>},
            success:function(o){
                console.log(1)
               if(o!=null&&o!=""){
                    clearInterval(Thread);
                   console.log(o)
                   $("#msg").fadeIn()
                   setTimeout(function () {
                       location.href=o
                   },2000)
               }
            }
        })
    },1000)
</script>
</body>
</html>
